//2009/08/26 17:47:52
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class GuessingNextElement
{
public:
    int guess(vector <int> A)
    {
		int a = A[A.size() - 1];
		int b = A[A.size() - 2];
		int c = A[A.size() - 3];
		if(a + c == 2 * b) return 2*a-b;
		if(b*b == a*c) return a/b*a;
    }
};
